/*play background music
using mci
the file is in the current directory
named bgm.bin
*/

#include "lovelight.h"

void playbgm(void)
{
    char str[500];
    char cmd[500];
    GetCurrentDirectory(500,str);
    wsprintf(cmd,"open \"%s\\bgm.mp3\" Alias snd",str);
    
    mciSendStringA("close snd",0,0,0);
    mciSendStringA(cmd,0, 0, 0);
    mciSendStringA("play snd",0,0,0);
    
    
    
}

int getMusicPosition(void)
{
    /*get the current position of the bgm*/
    char str[20];
    mciSendStringA("status snd position",str,20,0);
    return atoi(str);  
}

int getMusicLength(void)
{
    /*get the length of the bgm*/
    char str[20];
    mciSendStringA("status snd length",str,20,0);
    return atoi(str);  
}        
